import { Type } from 'class-transformer'
import { IsDate, IsNotEmpty, IsOptional, MaxLength } from 'class-validator'
import i18n from '@/i18n'
import { i18nMessage } from '@libs/lhy-common'
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'

export class MetaHistoryChartSaveDto {
  @ApiPropertyOptional({ description: i18n.t('dto.meta-history-chart-save.002594-1'), type: Number })
  @IsDate()
  @IsOptional()
  @Type(() => Date)
  limitBeginTime?: Date

  @ApiPropertyOptional({ description: i18n.t('dto.meta-history-chart-save.002594-2'), type: Number })
  @IsDate()
  @IsOptional()
  @Type(() => Date)
  limitEndTime?: Date

  @ApiPropertyOptional({ description: i18n.t('dto.meta-history-chart-save.002594-3') })
  @IsOptional()
  queryGranularity?: string

  @ApiPropertyOptional({ description: i18n.t('dto.meta-history-chart-save.002594-4') })
  @IsOptional()
  dataFillingStrategy?: string

  @ApiProperty({ description: i18n.t('dto.meta-history-chart-save.002594-5') })
  @IsNotEmpty()
  @MaxLength(64, { message: i18nMessage() })
  platform: string

  @ApiProperty({ description: i18n.t('dto.meta-history-chart-save.002594-6') })
  @MaxLength(64, { message: i18nMessage() })
  @IsOptional()
  project?: string
}
